/*
 * Copyright (c) 2011 Anthony Vandikas
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 
 * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, 
 * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software 
 * is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 
 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#pragma once

/**
 * Contains information regarding some sort of item 
 * that can be signed out by a student.
 * 
 * This is completely generic, and can apply to both textbooks and instruments.
 * For example: "French Horn" 4, "Calculus" 32.
 */
struct Item
{
public:
	/**
	 * Constructs a default item.
	 */
	Item();

	/**
	 * Creates a new item with a given name and number.
	 *
	 * @param name The name (or type) of the item.
	 * @param number The item number.
	 */
	Item(const QString &name, int number);

	/**
	 * Gets the name (or type) of the item.
	 */
	QString getName() const;

	/**
	 * Gets the item number.
	 */
	int getNumber() const;

	/**
	 * Sets the name of the item.
	 *
	 * @param value The value to store.
	 */
	void setName(const QString &value);

	/**
	 * Sets the item number.
	 *
	 * @param value The value to store.
	 */
	void setNumber(int value);
	
	/**
	 * Determines a string representation of this item.
	 */
	QString toString() const;

	/**
	 * Determines whether this item and another are equal.
	 *
	 * @param value The value to compare against.
	 */
	bool operator ==(const Item &value) const;

	/**
	 * Determines whether this item and another are not equal.
	 *
	 * @param value The value to compare against.
	 */
	bool operator !=(const Item &value) const;

private:
	QString name;
	int number;
};

/**
 * Writes an item to a stream.
 *
 * This is done in the same fashion as the Entry structure (see Entry.h)
 *
 * @param stream The stream to write to.
 * @param value The value to write.
 */
QDataStream &operator <<(QDataStream &stream, const Item &value);

/**
 * Reads an item from a stream.
 *
 * This is done in the same fashion as the Entry structure (see Entry.h)
 *
 * @param stream The stream to read from.
 * @param value The value to read into.
 *
 */
QDataStream &operator >>(QDataStream &stream, Item &value);
